import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'home',
    alias: ['/home', '/home2'], // 别名，可以定义很多个
    component: () => import('../views/page1.vue')
    // redirect: '/bar-tick-align'
  },
  {
    // 柱状图
    path: '/bar',
    name: 'bar',
    redirect: '/bar-background',
    children: [
      {
        // 带背景色柱状图
        path: '/bar-background',
        name: 'barBackground',
        component: () => import('../views/bar/bar-background.vue')
      },
      {
        // 基础柱状图
        path: '/bar-simple',
        name: 'barSimple',
        component: () => import('../views/bar/bar-simple.vue')
      },
      {
        // 坐标轴刻度与标签对齐
        path: '/bar-tick-align',
        name: 'barTickAlign',
        component: () => import('../views/bar/bar-tick-align.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
